socket.error: [Errno 10054]
Posted
by C0d3r
on Stack Overflow
See other posts from Stack Overflow
or by C0d3r
Published on 2010-06-17T04:46:53Z
Indexed on
2010/06/17
4:53 UTC
Read the original article
Hit count: 238
import socket, sys
if len(sys.argv) !=3 :
print "Usage: ./supabot.py <host> <port>"
sys.exit(1)
irc = sys.argv[1]
port = int(sys.argv[2])
sck = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sck.connect((irc, port))
sck.send('NICK supaBOT\r\n')
sck.send('USER supaBOT supaBOT supaBOT :supaBOT Script\r\n')
sck.send('JOIN #darkunderground' + '\r\n')
data = ''
while True:
data = sck.recv(1024)
if data.find('PING') != -1:
sck.send('PONG ' + data.split() [1] + '\r\n')
print data
elif data.find('!info') != -1:
sck.send('PRIVMSG #darkunderground supaBOT v1.0 by sourD' + '\r\n')
print sck.recv(1024)
when I run this code I get this error..
socket.error: [Errno 10054] An existing connection was forcibly closed by the remote host
it says that the error is in line 16, in data = sck.recv(1024)
© Stack Overflow or respective owner